<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Clojure documentation browser</title><style>
.library
{
  padding: 0.5em 0 0 0 
}
.all-libs-toggle,.library-contents-toggle
{
 font-size: small;
}
.all-libs-toggle a,.library-contents-toggle a
{
 color: white
}
.library-member-doc-whitespace
{
 white-space: pre
}
.library-member-source-toggle
{
  font-size: small;
  margin-top: 0.5em
}
.library-member-source
{
  display: none;
  border-left: solid lightblue 
}
.library-member-docs
{
  font-family:monospace
}
.library-member-arglists
{
  font-family: monospace
}
.library-member-type
{
  font-weight: bold; 
  font-size: small;
  font-style: italic;
  color: darkred
}
.lib-links
{
  margin: 0 0 1em 0
}

.lib-link-header
{
  color: white;
  background: darkgreen;
  width: 100%
}

.library-name 
{ 
  color: white;
  background: darkblue;
  width: 100%
}

.missing-library
{
  color: darkred; 
  margin: 0 0 1em 0 
}

.library-members
{
  list-style: none
}

.library-member-name
{
  font-weight: bold;
  font-size: 105%
}</style><script language="JavaScript" type="text/javascript"> // <![CDATA[

function getElem(id)
{
  if( document.getElementById )
  {
    return document.getElementById( id )
  }
  else if ( document.all )
  {
    return eval( 'document.all.' + id )
  }
  else
    return false;
}

function setDisplayStyle(id,displayStyle)
{
  var elem = getElem (id)
  if (elem)
  {
    elem.style.display = displayStyle
  }

}

function setLinkToggleText (id, text)
{
 var elem = getElem (id)
 if (elem)
 {
   elem.innerHTML = text
 }
}

function collapse(id)
{
  setDisplayStyle (id, 'none')
}

function expand (id)
{
  setDisplayStyle (id, 'block')
}

function toggleSource( id )
{
  toggle(id, 'linkto-' + id, 'Hide Source', 'Show Source')
}

function toggle(targetid, linkid, textWhenOpen, textWhenClosed)
{
  var elem = getElem (targetid)
  var link = getElem (linkid)

  if (elem && link)
  {
    var isOpen = false
    if (elem.style.display == '')
    {
      isOpen = link.innerHTML == textWhenOpen
    }
    else if( elem.style.display == 'block' )
    {
      isOpen = true
    }
    
    if (isOpen)
    {
      elem.style.display = 'none'
      link.innerHTML = textWhenClosed
    }
    else
    {
      elem.style.display = 'block'
      link.innerHTML = textWhenOpen
    }
  }
}

      //]]>
</script><script language="JavaScript" type="text/javascript">// <![CDATA[!
function expandAllNamespaces()
{
expand(&apos;library-contents-window&apos;);
setLinkToggleText(&apos;library-contents-toggle-window&apos;, &apos;-&apos;);

}function collapseAllNamespaces()
{
collapse(&apos;library-contents-window&apos;);
setLinkToggleText(&apos;library-contents-toggle-window&apos;, &apos;+&apos;);

}
// ]]></script></head><body><div class="lib-links"><div class="lib-link-header">Namespaces<span class="all-libs-toggle"> [ <a href="javascript:expandAllNamespaces()">Expand All</a> ] [ <a href="javascript:collapseAllNamespaces()">Collapse All</a> ]</span></div><a class="lib-link" href="#library-window">window</a></div><div class="library"><a name="library-window"/><div class="library-name"><span class="library-contents-toggle">[ <a id="library-contents-toggle-window" href="javascript:toggle(&apos;library-contents-window&apos;, &apos;library-contents-toggle-window&apos;, &apos;-&apos;, &apos;+&apos;)">-</a> ] </span>window</div><div class="library-contents" id="library-contents-window"><div class="library-member-links"><a class="lib-member-link" href="#member-window-blank?">blank?</a> <a class="lib-member-link" href="#member-window-buttonOn">buttonOn</a> <a class="lib-member-link" href="#member-window-createV">createV</a> <a class="lib-member-link" href="#member-window-emptyField?">emptyField?</a> <a class="lib-member-link" href="#member-window-field-empty?">field-empty?</a> <a class="lib-member-link" href="#member-window-file">file</a> <a class="lib-member-link" href="#member-window-filterLessRateThan">filterLessRateThan</a> <a class="lib-member-link" href="#member-window-filterMaximum">filterMaximum</a> <a class="lib-member-link" href="#member-window-filterMoreRateThan">filterMoreRateThan</a> <a class="lib-member-link" href="#member-window-filterMoreThan">filterMoreThan</a> <a class="lib-member-link" href="#member-window-filterT">filterT</a> <a class="lib-member-link" href="#member-window-filterVec">filterVec</a> <a class="lib-member-link" href="#member-window-get-string">get-string</a> <a class="lib-member-link" href="#member-window-get-vals">get-vals</a> <a class="lib-member-link" href="#member-window-getIndex">getIndex</a> <a class="lib-member-link" href="#member-window-headerArray">headerArray</a> <a class="lib-member-link" href="#member-window-parse-float">parse-float</a> <a class="lib-member-link" href="#member-window-parse-int">parse-int</a> <a class="lib-member-link" href="#member-window-prueba">prueba</a> <a class="lib-member-link" href="#member-window-recordVals">recordVals</a> <a class="lib-member-link" href="#member-window-records">records</a> <a class="lib-member-link" href="#member-window-searchfor">searchfor</a> <a class="lib-member-link" href="#member-window-showWarning">showWarning</a> <a class="lib-member-link" href="#member-window-smokeWhat">smokeWhat</a> <a class="lib-member-link" href="#member-window-tableData">tableData</a> <a class="lib-member-link" href="#member-window-tableSizeX">tableSizeX</a> <a class="lib-member-link" href="#member-window-tableSizeY">tableSizeY</a> <a class="lib-member-link" href="#member-window-theader">theader</a> <a class="lib-member-link" href="#member-window-updateTable">updateTable</a> <a class="lib-member-link" href="#member-window-whatWho">whatWho</a> <a class="lib-member-link" href="#member-window-window">window</a> <a class="lib-member-link" href="#member-window-xcount">xcount</a></div><ol class="library-members"><li class="library-member"><a name="member-window-blank?"/><dl class="library-member-table"><dt class="library-member-name">blank?</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([s])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Checks for an empty or an empty String</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-blank?&apos;)" id="linkto-membersource-window-blank?">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-blank?"><pre>(defn blank?
&quot;Checks for an empty or an empty String&quot;
[s]
(every? #(Character/isWhitespace %) s)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-buttonOn"/><dl class="library-member-table"><dt class="library-member-name">buttonOn</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([button])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns true if the button button is selected</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-buttonOn&apos;)" id="linkto-membersource-window-buttonOn">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-buttonOn"><pre>(defn buttonOn
&quot;Returns true if the button button is selected&quot;
[button]
(.isSelected button)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-createV"/><dl class="library-member-table"><dt class="library-member-name">createV</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([table])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Creates a register from the selected row in a table</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-createV&apos;)" id="linkto-membersource-window-createV">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-createV"><pre>(defn createV
&quot;Creates a register from the selected row in a table&quot;
[table]
(let [own (.getValueAt table (.getSelectedRow table) 0)
dat (.getValueAt table (.getSelectedRow table) 1)
rat (.getValueAt table (.getSelectedRow table) 2)
smo (.getValueAt table (.getSelectedRow table) 3)
siz (.getValueAt table (.getSelectedRow table) 4)
loc (.getValueAt table (.getSelectedRow table) 5)
nam (.getValueAt table (.getSelectedRow table) 6)
del (.getValueAt table (.getSelectedRow table) 7)
]
{:owner own,:date dat,:rate rat, :smoking smo,:size siz,:location loc,:name nam,:deleted del}
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-emptyField?"/><dl class="library-member-table"><dt class="library-member-name">emptyField?</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([field])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Checks for an empty field</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-emptyField?&apos;)" id="linkto-membersource-window-emptyField?">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-emptyField?"><pre>(defn emptyField?
&quot;Checks for an empty field&quot;
[field]
(if (field-empty? field)
true
false
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-field-empty?"/><dl class="library-member-table"><dt class="library-member-name">field-empty?</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([field])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Checks that a field has a blank String</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-field-empty?&apos;)" id="linkto-membersource-window-field-empty?">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-field-empty?"><pre>(defn field-empty?
&quot;Checks that a field has a blank String&quot;
[field]
(blank? (get-string field))
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-file"/><dl class="library-member-table"><dt class="library-member-name">file</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-file&apos;)" id="linkto-membersource-window-file">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-file"><pre>(def file &quot;db-1x2.db&quot;)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterLessRateThan"/><dl class="library-member-table"><dt class="library-member-name">filterLessRateThan</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of size sX with the values lesser than value in the field rate</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterLessRateThan&apos;)" id="linkto-membersource-window-filterLessRateThan">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterLessRateThan"><pre>(defn filterLessRateThan
&quot;Returns a partition of size sX with the values lesser than value in the field rate&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if (&gt;= (parse-float value) (parse-float (.substring (get (nth record a) field) 1)) )
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterMaximum"/><dl class="library-member-table"><dt class="library-member-name">filterMaximum</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of size sX with a maximum value of value in the field field</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterMaximum&apos;)" id="linkto-membersource-window-filterMaximum">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterMaximum"><pre>(defn filterMaximum
&quot;Returns a partition of size sX with a maximum value of value in the field field&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if (&lt;= (parse-int (get (nth record a) field)) (parse-int value) )
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterMoreRateThan"/><dl class="library-member-table"><dt class="library-member-name">filterMoreRateThan</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of size sX with the values bigger than value in the field rate</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterMoreRateThan&apos;)" id="linkto-membersource-window-filterMoreRateThan">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterMoreRateThan"><pre>(defn filterMoreRateThan
&quot;Returns a partition of size sX with the values bigger than value in the field rate&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if (&lt;= (parse-float value) (parse-float (.substring (get (nth record a) field) 1)) )
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterMoreThan"/><dl class="library-member-table"><dt class="library-member-name">filterMoreThan</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of size sX with the values bigger than value in the field field</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterMoreThan&apos;)" id="linkto-membersource-window-filterMoreThan">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterMoreThan"><pre>(defn filterMoreThan
&quot;Returns a partition of size sX with the values bigger than value in the field field&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if (&gt; (parse-int (get (nth record a) field)) (parse-int value))
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterT"/><dl class="library-member-table"><dt class="library-member-name">filterT</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of size sX from a record that matches with the value value</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterT&apos;)" id="linkto-membersource-window-filterT">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterT"><pre>(defn filterT
&quot;Returns a partition of size sX from a record that matches with the value value&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if(zero? (.compareTo (.toLowerCase value) (.toLowerCase (get (nth record a) field))))
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-filterVec"/><dl class="library-member-table"><dt class="library-member-name">filterVec</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a vector that matches with the value value</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-filterVec&apos;)" id="linkto-membersource-window-filterVec">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-filterVec"><pre>(defn filterVec
&quot;Returns a vector that matches with the value value&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if(zero? (.compareTo (.toLowerCase value) (.toLowerCase (get (nth record a) field))))
(partition sX (nth record a))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-get-string"/><dl class="library-member-table"><dt class="library-member-name">get-string</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([field])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns the string value from a JField</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-get-string&apos;)" id="linkto-membersource-window-get-string">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-get-string"><pre>(defn get-string
&quot;Returns the string value from a JField&quot;
[field]
(.getText field)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-get-vals"/><dl class="library-member-table"><dt class="library-member-name">get-vals</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([n wide record])</span></div><div class="library-member-docs"><div class="library-member-doc-line">returns a list with the values of the record</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-get-vals&apos;)" id="linkto-membersource-window-get-vals">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-get-vals"><pre>(defn get-vals
&quot;returns a list with the values of the record&quot;
[n wide record]
(for [a (range 0 n)
t (partition wide (vals (nth record a)))]
t
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-getIndex"/><dl class="library-member-table"><dt class="library-member-name">getIndex</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([file value sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a number that corresponds to the value in the table</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-getIndex&apos;)" id="linkto-membersource-window-getIndex">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-getIndex"><pre>(defn getIndex
&quot;Returns a number that corresponds to the value in the table&quot;
[file value sY]
(loop [c 0]
(when (&lt; c sY)
(if (zero? (compare (str value) (str (nth (get-records file) c ))))
(def xcount c)
)
(recur (inc c))
)
)
xcount
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-headerArray"/><dl class="library-member-table"><dt class="library-member-name">headerArray</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-headerArray&apos;)" id="linkto-membersource-window-headerArray">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-headerArray"><pre>(def headerArray (to-array theader))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-parse-float"/><dl class="library-member-table"><dt class="library-member-name">parse-float</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([str])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a float integer given a string</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-parse-float&apos;)" id="linkto-membersource-window-parse-float">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-parse-float"><pre>(defn parse-float
&quot;Returns a float integer given a string&quot;
[str]
(try (Float/parseFloat str)
(catch NumberFormatException nfe 0.0))
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-parse-int"/><dl class="library-member-table"><dt class="library-member-name">parse-int</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([str])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns an integer given a string</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-parse-int&apos;)" id="linkto-membersource-window-parse-int">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-parse-int"><pre>(defn parse-int
&quot;Returns an integer given a string&quot;
[str]
(try (Integer/parseInt str)
(catch NumberFormatException nfe 0))
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-prueba"/><dl class="library-member-table"><dt class="library-member-name">prueba</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([sizeY sizeX structure])</span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-prueba&apos;)" id="linkto-membersource-window-prueba">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-prueba"><pre>(defn prueba
[sizeY sizeX structure]
(for [i (range 0 sizeY)]
(for[j (range 0 sizeX)]
(aget structure sizeX sizeY)
)
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-recordVals"/><dl class="library-member-table"><dt class="library-member-name">recordVals</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-recordVals&apos;)" id="linkto-membersource-window-recordVals">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-recordVals"><pre>(def recordVals (get-vals tableSizeY tableSizeX records))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-records"/><dl class="library-member-table"><dt class="library-member-name">records</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-records&apos;)" id="linkto-membersource-window-records">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-records"><pre>(def records (get-records file))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-searchfor"/><dl class="library-member-table"><dt class="library-member-name">searchfor</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([record value field sX sY])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Returns a partition of a record with size sX that has the same value as value</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-searchfor&apos;)" id="linkto-membersource-window-searchfor">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-searchfor"><pre>(defn searchfor
&quot;Returns a partition of a record with size sX that has the same value as value&quot;
[record value field sX sY]
(for [a (range 0 sY)
result (if(zero? (.compareTo value (get (nth record a) field)))
(partition sX (vals (nth record a)))
)
]
result
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-showWarning"/><dl class="library-member-table"><dt class="library-member-name">showWarning</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([text])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Creates a Warning MessageDialog with a text</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-showWarning&apos;)" id="linkto-membersource-window-showWarning">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-showWarning"><pre>(defn showWarning
&quot;Creates a Warning MessageDialog with a text&quot;
[text]
;JOptionPane.showMessageDialog(frame,&quot;Eggs are not supposed to be green.&quot;,&quot;Inane warning&quot;,JOptionPane.WARNING_MESSAGE);
(. javax.swing.JOptionPane (showMessageDialog nil text &quot;Warning&quot; JOptionPane/WARNING_MESSAGE))
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-smokeWhat"/><dl class="library-member-table"><dt class="library-member-name">smokeWhat</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([smokeY smokeN])</span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-smokeWhat&apos;)" id="linkto-membersource-window-smokeWhat">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-smokeWhat"><pre>(defn smokeWhat
[smokeY smokeN]
(if (.isSelected smokeY)
&quot;Y&quot;
&quot;N&quot;
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-tableData"/><dl class="library-member-table"><dt class="library-member-name">tableData</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-tableData&apos;)" id="linkto-membersource-window-tableData">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-tableData"><pre>(def tableData (to-array-2d recordVals))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-tableSizeX"/><dl class="library-member-table"><dt class="library-member-name">tableSizeX</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-tableSizeX&apos;)" id="linkto-membersource-window-tableSizeX">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-tableSizeX"><pre>(def tableSizeX (count (keys (first records))))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-tableSizeY"/><dl class="library-member-table"><dt class="library-member-name">tableSizeY</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-tableSizeY&apos;)" id="linkto-membersource-window-tableSizeY">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-tableSizeY"><pre>(def tableSizeY (get-numFields file))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-theader"/><dl class="library-member-table"><dt class="library-member-name">theader</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-theader&apos;)" id="linkto-membersource-window-theader">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-theader"><pre>(def theader (keys (first records)))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-updateTable"/><dl class="library-member-table"><dt class="library-member-name">updateTable</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([file tabSizeX tabSizeY tab header])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Updates the table model with the information from a file</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-updateTable&apos;)" id="linkto-membersource-window-updateTable">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-updateTable"><pre>(defn updateTable
&quot;Updates the table model with the information from a file&quot;
[file tabSizeX tabSizeY tab header]
(let [
records (get-records file)
recordValsU (get-vals tabSizeY tabSizeX records)
tableDataU (to-array-2d recordValsU)
modelU (DefaultTableModel. tableDataU header)
]
(.setModel tab modelU)
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-whatWho"/><dl class="library-member-table"><dt class="library-member-name">whatWho</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([occup1 occup2 occup4 occup6 occup6more])</span></div><div class="library-member-docs"><div class="library-member-doc-line">returns the value of the selected button</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-whatWho&apos;)" id="linkto-membersource-window-whatWho">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-whatWho"><pre>(defn whatWho
&quot;returns the value of the selected button&quot;
[occup1 occup2 occup4 occup6 occup6more]
(if (.isSelected occup1)
&quot;1&quot;
(let []
(if (.isSelected occup2)
&quot;2&quot;
(let []
(if (.isSelected occup4)
&quot;4&quot;
(let []
(if (.isSelected occup6)
&quot;6&quot;
(let []
(if (.isSelected occup6more)
&quot;7&quot;
)
)
)
)
)
)
)
)
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-window"/><dl class="library-member-table"><dt class="library-member-name">window</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([title])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Window used as the GUI for the URLyBird</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-window-window&apos;)" id="linkto-membersource-window-window">Show Source</a> ]</div><div class="library-member-source" id="membersource-window-window"><pre>(defn window
&quot;Window used as the GUI for the URLyBird&quot;
[title]
(def file &quot;db-1x2.db&quot;)
(def records (get-records file))
(def tableSizeY (get-numFields file));table size obtained from the db number of fields
(def theader (keys (first records)));table header based on the file
(def tableSizeX (count (keys (first records))))
(def headerArray (to-array theader))


(def recordVals (get-vals tableSizeY tableSizeX records))
(def tableData (to-array-2d recordVals))


(let [frame (JFrame. title)
maxContainer (JPanel. (GridLayout. 0 1))
container (JPanel. (GridLayout. 0 2))
tableCont (JPanel. (FlowLayout. ))
search (JButton. &quot;Search&quot;)
showall (JButton. &quot;Show all&quot;)
register (JButton. &quot;Register&quot;)
delete (JButton. &quot;Delete&quot;)
hotelL (JLabel. &quot;Hotel Name:&quot; JLabel/CENTER)
hotelF (JTextField. 20)
cityL (JLabel. &quot;City: &quot; JLabel/CENTER)
cityF (JTextField. 20)
occupL (JLabel. &quot;Maximum Occupancy of this room:&quot; JLabel/CENTER)
occupP (JPanel. (FlowLayout. ))
occupB1 (JRadioButton. &quot;1&quot;)
occupB2 (JRadioButton. &quot;2&quot;)
occupB4 (JRadioButton. &quot;4&quot;)
occupB6 (JRadioButton. &quot;6&quot;)
occupB6_more (JRadioButton. &quot;+6&quot;)
buttonG (ButtonGroup. )
smokingL (JLabel. &quot;Smoking Room?:&quot; JLabel/CENTER)
smokingF (JPanel. (FlowLayout. ))
smokingFY (JRadioButton. &quot;Yes&quot;)
smokingFN (JRadioButton. &quot;No&quot;)
buttonS (ButtonGroup. )
priceL (JLabel. &quot;Maximum Price per night(USD)&quot; JLabel/CENTER)
priceTF (JTextField. 10)
priceP (JPanel. (FlowLayout. ))
priceF (JComboBox. )
customL (JLabel. &quot;Customer holding this record:&quot; JLabel/CENTER)
customF (JTextField. 20)


model (DefaultTableModel. tableData headerArray)
table (JTable. model )
tabScroll (JScrollPane. table)
tableHeader (JTableHeader. )



handlerShow_all (proxy [ActionListener][]
(actionPerformed [event]
(let [
records (get-records file)
recordValsU (get-vals tableSizeY tableSizeX records)
tableDataU (to-array-2d recordValsU)
modelU (DefaultTableModel. tableDataU headerArray)
]
(.setModel table modelU)
)
;updateTable(file tableSizeX tableSizeY table headerArray)
)
)





handlersearch (proxy [ActionListener][]
(actionPerformed [event]
;actions

(if (and (emptyField? hotelF) (emptyField? cityF) (emptyField? customF) (emptyField? priceTF) ;fields
; (= false (&gt; (.getSelectedIndex priceF) 0)) ; comboBox
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(showWarning &quot;You must fill at least one field&quot;)
;else
)

; search just names
(if (and (emptyField? customF) (emptyField? cityF) (emptyField? priceTF);fields
(= false (emptyField? hotelF))
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
))
)
(let [
cont (count (filterT (get-records file) (get-string hotelF) :name tableSizeX tableSizeY))
records2 (filterT (get-records file) (get-string hotelF) :name tableSizeX tableSizeY)
recordVals2 (get-vals cont tableSizeX records2)
tableDataN (to-array-2d recordVals2)
model2 (DefaultTableModel. tableDataN headerArray)]
(.setModel table model2))
;else
()
)
; search locations
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? priceTF);fields
(= false (emptyField? cityF))
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
))
)
;(println (filterT records (get-string cityF) :location tableSizeX tableSizeY))
(let [
cont (count (filterT (get-records file) (get-string cityF) :location tableSizeX tableSizeY))
records3 (filterT (get-records file) (get-string cityF) :location tableSizeX tableSizeY)
recordVals3 (get-vals cont tableSizeX records3)
tableDataC (to-array-2d recordVals3)
model3 (DefaultTableModel. tableDataC headerArray)]
(.setModel table model3))
;else
()
)
; search smoking Yes
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (buttonOn smokingFY))
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFN)
))
)
(let [
cont (count (filterT (get-records file) &quot;Y&quot; :smoking tableSizeX tableSizeY))
records4 (filterT (get-records file) &quot;Y&quot; :smoking tableSizeX tableSizeY)
recordVals4 (get-vals cont tableSizeX records4)
tableDataSY (to-array-2d recordVals4)
model2 (DefaultTableModel. tableDataSY headerArray)]
(.setModel table model2))
;else
()
)
; search smoking No
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (buttonOn smokingFN))
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY)
))
)
(let [
cont (count (filterT (get-records file) &quot;N&quot; :smoking tableSizeX tableSizeY))
records5 (filterT (get-records file) &quot;N&quot; :smoking tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)


; search occupancy &lt;=1
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (.isSelected occupB1))
(= false (or (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(let [
cont (count (filterMaximum (get-records file) &quot;1&quot; :size tableSizeX tableSizeY))
records5 (filterMaximum (get-records file) &quot;1&quot; :size tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)
; search occupancy &lt;=2
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (.isSelected occupB2))
(= false (or (.isSelected occupB1) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(let [
cont (count (filterMaximum (get-records file) &quot;2&quot; :size tableSizeX tableSizeY))
records5 (filterMaximum (get-records file) &quot;2&quot; :size tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)
; search occupancy &lt;=4
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (.isSelected occupB4))
(= false (or (.isSelected occupB2) ;radio buttons
(.isSelected occupB1) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(let [
cont (count (filterMaximum (get-records file) &quot;4&quot; :size tableSizeX tableSizeY))
records5 (filterMaximum (get-records file) &quot;4&quot; :size tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)
; search occupancy &lt;=6
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (.isSelected occupB6))
(= false (or (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB1) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(let [
cont (count (filterMaximum (get-records file) &quot;6&quot; :smoking tableSizeX tableSizeY))
records5 (filterMaximum (get-records file) &quot;6&quot; :smoking tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)
; search occupancy 6+
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF) (emptyField? priceTF);fields
(= true (.isSelected occupB6_more))
(= false (or (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB1)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(let [
cont (count (filterMoreThan (get-records file) &quot;7&quot; :smoking tableSizeX tableSizeY))
records5 (filterMoreThan (get-records file) &quot;7&quot; :smoking tableSizeX tableSizeY)
recordVals5 (get-vals cont tableSizeX records5)
tableDataSN (to-array-2d recordVals5)
model2 (DefaultTableModel. tableDataSN headerArray)]
(.setModel table model2))
;else
()
)

; search price
(if (and (emptyField? customF) (emptyField? hotelF) (emptyField? cityF);fields
(= false (emptyField? priceTF))
(= false (or (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN) (.isSelected occupB1)
)
)
)
(let [
contC1 (count (filterLessRateThan (get-records file) (get-string priceTF) :rate tableSizeX tableSizeY))
recordsC1 (filterLessRateThan (get-records file) (get-string priceTF) :rate tableSizeX tableSizeY)
recordValsC1 (get-vals contC1 tableSizeX recordsC1)
tableDataSNC1 (to-array-2d recordValsC1)
modelC1 (DefaultTableModel. tableDataSNC1 headerArray)]
(.setModel table modelC1))
;else
()
)


;reset all the fields
(. cityF (setText &quot;&quot;))
(. hotelF (setText &quot;&quot;))
(. customF (setText &quot;&quot;))
(. buttonG (clearSelection))
(. buttonS (clearSelection))
(. priceTF (setText &quot;&quot;))

;end of actions
))

handlerRegister (proxy [ActionListener][]
(actionPerformed [event]

(if (and (emptyField? hotelF) (emptyField? cityF) (emptyField? customF) (emptyField? priceTF) ;fields
(= false (or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
(.isSelected smokingFY) (.isSelected smokingFN)
)
)
)
(showWarning &quot;None of the fields can be blank in order to create a new register&quot;)
;else
)

(if (and (= false (emptyField? hotelF)) (= false (emptyField? cityF)) (= false (emptyField? customF)) (= false (emptyField? priceTF)) ;fields
(or (.isSelected occupB1) (.isSelected occupB2) ;radio buttons
(.isSelected occupB4) (.isSelected occupB6) (.isSelected occupB6_more)
)
(or (.isSelected smokingFY) (.isSelected smokingFN))
)
(let [
dateFormat (SimpleDateFormat. &quot;yyyy/MM/dd&quot;)
date (Date.)
datetimeS (.format dateFormat date)
]
(new-values file (get-numFields file) (get-string hotelF) (get-string cityF) (whatWho occupB1 occupB2 occupB4 occupB6 occupB6_more) (smokeWhat smokingFY smokingFN) (.concat &quot;$&quot; (get-string priceTF)) (.concat &quot;&quot; datetimeS) (get-string customF))
;(println file (get-numFields file) (get-string hotelF) (get-string cityF) (whatWho occupB1 occupB2 occupB4 occupB6 occupB6_more) (smokeWhat smokingFY smokingFN) (.concat &quot;$&quot; (get-string priceTF)) (.concat &quot;00/00/00&quot; &quot;&quot;) (get-string customF))
(println file (get-numFields file) (get-string hotelF) (get-string cityF) (whatWho occupB1 occupB2 occupB4 occupB6 occupB6_more) (smokeWhat smokingFY smokingFN) (.concat &quot;$&quot; (get-string priceTF)) (.concat &quot;&quot; datetimeS) (get-string customF))
(showWarning &quot;A register has been added&quot;)

)
)

(let [
records (get-records file)
recordValsU (get-vals tableSizeY tableSizeX records)
tableDataU (to-array-2d recordValsU)
modelU (DefaultTableModel. tableDataU headerArray)
]
(.setModel table modelU)
)

)
)

handlerDelete (proxy [ActionListener][]
(actionPerformed [event]

(let [ vect (createV table)]
(println (str (getIndex file (createV table) tableSizeY)))
)
(print &quot;Deleted register: &quot;)
(println (createV table))
(erase file (getIndex file (createV table) tableSizeY))

(showWarning (str (createV table)))
;update the table
(let [
records (get-records file)
recordValsU (get-vals tableSizeY tableSizeX records)
tableDataU (to-array-2d recordValsU)
modelU (DefaultTableModel. tableDataU headerArray)
]
(.setModel table modelU)
)

))

]


(.setDefaultCloseOperation frame JFrame/EXIT_ON_CLOSE)
(.add maxContainer container)


(.add tableCont tabScroll)
(.setPreferredScrollableViewportSize table (Dimension. 600 200))
(.setFillsViewportHeight table true)
(.setPreferredSize tabScroll (Dimension. 600 200))
(.setPreferredSize tableCont (Dimension. 600 200))
(.add tableCont (JSeparator. ))
(.add maxContainer tableCont)

(.add frame BorderLayout/CENTER maxContainer)
(.add frame BorderLayout/WEST (JLabel. &quot; &quot; JLabel/CENTER))
(.add frame BorderLayout/EAST (JLabel. &quot; &quot; JLabel/CENTER))
(.add frame BorderLayout/NORTH (JLabel. &quot;Search Hotels&quot; JLabel/CENTER))
(doto priceF
(.addItem &quot; &quot;)
(.addItem &quot;&lt;100&quot;)
(.addItem &quot;100-150&quot;)
(.addItem &quot;&gt;150&quot;)
)
(.add buttonG occupB1)
(.add buttonG occupB2)
(.add buttonG occupB4)
(.add buttonG occupB6)
(.add buttonG occupB6_more)
(.add occupP occupB1)
(.add occupP occupB2)
(.add occupP occupB4)
(.add occupP occupB6)
(.add occupP occupB6_more)
(.add buttonS smokingFN)
(.add buttonS smokingFY)
(.add container hotelL)
(.add container hotelF)
(.add container (JSeparator. ))
(.add container (JSeparator. ))
(.add container cityL)
(.add container cityF)
(.add container occupL)
(.add container occupP)
(.add container smokingL)
(.add smokingF smokingFN)
(.add smokingF smokingFY)
(.add container smokingF)
(.add container priceL)
(.add container priceTF)
(.add container customL)
(.add container customF)
(.add container search)
(.add container showall)
(.add container register)
(.add container delete)
(.add container (JSeparator. ))
(.add container (JSeparator. ))
(.pack frame)
(.setSize frame 800 600)
(.setVisible frame true)

(.addActionListener showall handlerShow_all)
(.addActionListener search handlersearch)
(.addActionListener register handlerRegister)
(.addActionListener delete handlerDelete)
)
)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-window-xcount"/><dl class="library-member-table"><dt class="library-member-name">xcount</dt><dd><div class="library-member-info"><span class="library-member-type">unknown</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/></dd></dl></li></ol></div></div></body></html>